#include <iostream>
#include <list>
#include <string>
using namespace std;
template <typename Container>
void display(const Container &con)
{
    for(auto &elem : con)
    {
        cout <<"名字: " <<elem._name << 
        " 语文成绩:"<< elem._Chinese<< 
        " 总分：" << elem._Sum << endl;
    }
}
        
class student{
public:
    student(string name,int Chinese,int Math,int English)
    :_name(name)
    ,_Chinese(Chinese)
    ,_Math(Math)
    ,_English(English)
    ,_Sum(Chinese + Math + English)
    {}
    string _name;
    int _Chinese;
    int _Math;
    int _English;
    int _Sum;
};
struct   CompareList
{
        bool operator()(const student & lhs,const student & rhs)const {
        if(lhs._Sum == rhs._Sum){
            return lhs._Chinese > rhs._Chinese;
        }
        return lhs._Sum>rhs._Sum;
    }
};

void test(){
        list<student> ls = {
        {"zs", 95, 99, 62},
        {"ww", 85, 58, 65},
        {"ls", 85, 99, 72}  
    };
    ls.sort(CompareList());
    display(ls);
}
int main()
{
    test();
    return 0;
}

